package com.nuc.thread.status;

import lombok.extern.slf4j.Slf4j;

/**
 * @Description
 * @Author 诗酒趁年华
 * @Version V1.0.0
 * @Date 2021/5/5
 */
@Slf4j
public class SleepTest1 {
    public static void main(String[] args) {
        Thread thread = new Thread("t1"){
            @Override
            public void run() {
                log.debug("running");
                try {
                    Thread.sleep(2000);//子线程Sleep2秒
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        thread.start();
        try {
            Thread.sleep(1000);//主线程sleep1秒
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.debug("子线程t1的状态为{}",thread.getState());
    }
}
